<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/components/News.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\index.html">All files</a> / <a href="index.html">src/components</a> News.vue
    </h1>
    <div class='clearfix'>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
  &lt;div id="app"&gt;
&nbsp;
    &lt;div id="pad-w"&gt;
        &lt;div class="h-10"&gt;&lt;/div&gt;
        &lt;van-row type="flex" gutter="10"  justify="space-between"&gt;
          &lt;van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onJiazai" :immediate-check="immediate"&gt;
            &lt;van-col span="24" v-for="(list, index) in list" :key="index" class="span12"  @click="tiao(list.id)"&gt;
              &lt;img v-lazy="list.picurl"  /&gt;
              &lt;van-cell size="large"&gt;
                &lt;!-- 使用 title 插槽来自定义标题 --&gt;
                &lt;template #title&gt;
                  {{list.title}}
                &lt;/template&gt;
                &lt;template #label&gt;
                  &lt;van-icon name="underway-o" /&gt;&amp;nbsp;{{list.time}}
                &lt;/template&gt;
              &lt;/van-cell&gt;
            &lt;/van-col&gt;
          &lt;/van-list&gt;
        &lt;/van-row&gt;
    &lt;/div&gt;
    &lt;div class="h-50"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
export default {
<span class="fstat-no" title="function not covered" >  data () {</span>
<span class="cstat-no" title="statement not covered" >    return {</span>
      list: [],
      immediate:false,
      loading: false,
      finished: false,
      page: 1,//请求第几页
      total: 0,//总共的数据条数
    }
  },
  components: {
  },
<span class="fstat-no" title="function not covered" >  created:function () {</span>
<span class="cstat-no" title="statement not covered" >      this.$emit('footer', true);</span>
  },
&nbsp;
<span class="fstat-no" title="function not covered" >  mounted () {</span>
<span class="cstat-no" title="statement not covered" >    this.recordapi();</span>
  },
<span class="fstat-no" title="function not covered" >	activated() {</span>
<span class="cstat-no" title="statement not covered" >		if (this.$route.meta.keepAlive) {</span>
<span class="cstat-no" title="statement not covered" >			this.$emit('footer', true);</span>
		}
	},
  	methods: {
<span class="fstat-no" title="function not covered" >      tiao(e){</span>
<span class="cstat-no" title="statement not covered" >        this.$router.push('Newscont?id='+e)</span>
<span class="cstat-no" title="statement not covered" >        console.log(e);</span>
      },
<span class="fstat-no" title="function not covered" >      recordapi(){</span>
<span class="cstat-no" title="statement not covered" >          var that = this;</span>
<span class="cstat-no" title="statement not covered" >          var userid = that.$cookieStore.getCookie('userid');</span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >          that.$api.post("/Index/newslist",{'page':this.page}).then(res =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >            console.log(res);</span>
<span class="cstat-no" title="statement not covered" >            let rows = res.list.data; //请求返回当页的列表</span>
            // // console.log(that.page);
<span class="cstat-no" title="statement not covered" >            console.log(rows)</span>
<span class="cstat-no" title="statement not covered" >             that.loading  = false;</span>
<span class="cstat-no" title="statement not covered" >             that.pageSize = res.list.per_page;</span>
<span class="cstat-no" title="statement not covered" >             that.total    = res.list.total;</span>
<span class="cstat-no" title="statement not covered" >             if (rows == null || rows.length === 0) {</span>
               // 加载结束
<span class="cstat-no" title="statement not covered" >               that.finished = true;</span>
<span class="cstat-no" title="statement not covered" >               return;</span>
             }
            // 将新数据与老数据进行合并
<span class="cstat-no" title="statement not covered" >             that.list = that.list.concat(rows);</span>
            // //如果列表数据条数&gt;=总条数，不再触发滚动加载
<span class="cstat-no" title="statement not covered" >            if(that.list.length &gt;= that.total){</span>
<span class="cstat-no" title="statement not covered" >               that.finished = true;</span>
            }
          });
      },
      // 加载
<span class="fstat-no" title="function not covered" >      onJiazai:function(){</span>
<span class="cstat-no" title="statement not covered" >        var that = this;</span>
<span class="cstat-no" title="statement not covered" >        that.page++;</span>
<span class="cstat-no" title="statement not covered" >        console.log(that.page)</span>
<span class="cstat-no" title="statement not covered" >        that.recordapi()</span>
      },
    }
}
&lt;/script&gt;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 27 2023 23:16:11 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\sorter.js"></script>
</body>
</html>
